﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>分配工作</title>
    <!--
    1, 分配工作界面。
    2，需要 FK_Flow, FK_Node,WorkID, FID.
    3, 调用方法 Allot.htm?FK_Flow=001&FK_Node=103&WorkID=232&FID=23
    -->
    <meta http-equiv="Access-Control-Allow-Origin" content="*" />
    <link href="../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/components-rounded.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/themes/default/style.min.css" rel="stylesheet" />
    <link href="../../DataUser/Style/ccbpm.css" rel="Stylesheet" />
    <script type="text/javascript" src="../Scripts/QueryString.js"></script>
    <script type="text/javascript" src="../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../Scripts/bootstrap/js/jquery.cokie.min.js"></script>
    <script src="../Scripts/QueryString2016.js"></script>
    <script type="text/javascript" src="../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <!-- 导入配置文件. -->
    <script type="text/javascript" src="../Scripts/config.js"></script>
    <style type="text/css">
        body {
            background: transparent;
        }
            body div {
                text-align: left;
            }
        #Message {
        width:100%;
        }
    </style>
    <script type="text/javascript">
        var param={};
    $(function () {
        //初始化
        param = {
            FK_Node: GetQueryString('FK_Node'),
            WorkID: GetQueryString('WorkID'),
            FID: GetQueryString('FID'),
            Message: GetQueryString('Info'),
            FK_Flow:GetQueryString("FK_Flow")
        };
        $('#Message').val(param.Message);
        //初始化人员选择窗口
        var selectEmpModalHtml = '<div class="modal fade" id="selectEmpsModal" style="width: 80%;margin: 40px auto;">' +
           '<div class="modal-dialog" style="margin: 0px;">'
               + '<div class="modal-content" style="border-radius:0px;width:700px;">'
                  + '<div class="modal-header">'
                      + '<button type="button" class="close" style="color:white;opacity:1;" data-dismiss="modal" aria-hidden="true">&times;</button>'
                       + '<h4 class="modal-title">选择移交人</h4>'
                   + '</div>'
                   + '<div class="modal-body">'
                       + '<iframe style="width:100%;border:0px;height:400px;" id="iframeSelectEmpsForm" name="iframeSelectEmpsForm"></iframe>'
                   + '</div>'
               + '</div><!-- /.modal-content -->'
           + '</div><!-- /.modal-dialog -->'
       + '</div>';

        $('body').append($(selectEmpModalHtml));
        $('#iframeSelectEmpsForm').attr('src', "SelectEmps.htm?FK_Dept=" + getQueryStringByNameFromUrl("?" + $.cookie('CCS'), "FK_Dept") + "&s=" + Math.random());

        $('#BtnSelectEmps').bind('click', function () { $('#selectEmpsModal').modal().show(); });
        $("section").show();
        $(".wait").hide();
        
    });

    //确定  执行移交操作
    function ReturnWork() {
        //WorkID, this.FID, this.FK_Node
        var empNos = frames["iframeSelectEmpsForm"].window.returnVal.NO;
        $.ajax({
            type: 'post',
            async: true,
            data: { FK_Flow: param.FK_Flow, WorkID: param.WorkID, FID: param.FID, FK_Node: param.FK_Node },
            url: Handler + "?DoType=Allot&FK_Flow=" + param.FK_Flow + "&WorkID=" + param.WorkID + "&FID=" + param.FID + "&FK_Node=" + param.FK_Node + "&m=" + Math.random() + "&ToEmp=" + empNos + '&Message=' + $('#Message').val(),
            dataType: 'html',
            success: function (data) {
                if (window.parent != null && window.parent.returnWorkWindowClose != null) {
                    window.parent.returnWorkWindowClose(data);
                } else {
                    $('body').append($('<div>' + data + '</div>'));
                }
            }
        });
        $(".foot").hide();
    }

    //取消移交
    function Close() {
        if (window.parent != null && window.parent.returnWorkWindowClose != null) {
            window.parent.returnWorkWindowClose("取消");
        } else {
            $('body').append($('<div>' + "已取消操作" + '</div>'));
            window.close();
        }
    }
    //设置选中的人员
    function selectEmpsWindowClose(data) {
        $('#selectEmpsModal').modal('hide');
        if (data == '取消') {
            return;
        } else {
            $('#ToEmp').val(frames["iframeSelectEmpsForm"].window.returnVal.NAME);
        }
    }
    </script>

</head>
<body>
<div class="wait" style="text-align: center;">页面数据正在加载中，请稍候......</div>
<section style="display: none;">
    <div>
        请选择要分配的人:
        <input type="text" id="ToEmp" name="ToEmp" value='' style="width: 81%;"/> <input type="button" id="BtnSelectEmps" value='选择接受人' style="position: relative; right: -562px; top: -41px; border-radius: 0px 25px 25px 0px; height: 27px;"/>
        <br/>
    </div>
    <div>
        分配工作说明:
        <textarea name="Message" id="Message" style="vertical-align: top; width: 100%;"></textarea>
    </div>
    <div style="position: fixed; bottom: 0px; right: 0px;" class="foot">
        <input type=button value="确定分配" onclick="ReturnWork();"/>
        <input type="button" id="" value="关闭" onclick="Close();"/>
    </div>
</section>
</body>
</html>
